//
//  ZYLSearchTableView.m
//  Cartoon
//
//  Created by dllo on 15/7/14.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "ZYLSearchTableView.h"
#import "UIImageView+WebCache.h"
#import "ZYLSearchResultModel.h"
#import "ZYLSearchTableViewCell.h"
@interface ZYLSearchTableView ()

@end

@implementation ZYLSearchTableView

- (void)dealloc
{
    [_searchResultDataArray release];
    [super dealloc];
}

- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style
{
    self = [super initWithFrame:frame style:style];
    if (self) {
        [self createTableView];
    }
    
    return self;
}

- (void)createTableView
{
    self.delegate = self;
    self.dataSource = self;
    [self registerClass:[ZYLSearchTableViewCell class] forCellReuseIdentifier:@"searchTableView"];
    self.backgroundColor = [UIColor whiteColor];
    self.rowHeight = 100;
    
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.searchResultDataArray.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    ZYLSearchTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"searchTableView" forIndexPath:indexPath];
    cell.resultModel = self.searchResultDataArray[indexPath.row];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
    
}

@end
